<!--_meta 作为公共模版分离出去-->
<#include "include/_meta.html">
<!--/meta 作为公共模版分离出去-->

<title>车辆管理-添加保险记录</title>
<meta name="keywords" content="汽车租赁">
<meta name="description" content="H-ui.admin v2.3，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-insurance-add" >	
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>车牌号：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="" placeholder="车牌号" id="carid" name="carid" onblur="getCarid()">
		</div>
	</div>		
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>保险公司：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="" placeholder="保险公司" id="company" name="company">
		</div>
	</div>	
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>出险电话：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="" placeholder="出险电话" id="companyphone" name="companyphone">
		</div>
	</div>	
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>保险编号：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="" placeholder="保险编号" id="code" name="code">
		</div>
	</div>		
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>保险内容：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="" placeholder="保险内容" id="content" name="content">
		</div>
	</div>		
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>保险费用：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="" placeholder="保险费用" id="money" name="money">
		</div>
	</div>					
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>生效日期：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text"  class="input-text Wdate" onfocus="WdatePicker({skin:'whyGreen',startDate:'%y-%M-%d %H:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss'})" autocomplete="off"  placeholder="生效日期" id="validdate" name="validdate">
		</div>																	
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>失效日期：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text"  class="input-text Wdate" onfocus="WdatePicker({skin:'whyGreen',startDate:'%y-%M-%d %H:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss'})" autocomplete="off"  placeholder="失效日期" id="invaliddate" name="invaliddate">
		</div>
	</div>	
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>经办人：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="" placeholder="经办人" id="contactman" name="contactman">
		</div>
	</div>
	
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>经办手机：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="" placeholder="经办手机" id="contactmobile" name="contactmobile">
		</div>
	</div>
	
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">备注：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<textarea id="remark" name="remark" cols="" rows="" class="textarea"  placeholder="说点什么...100个字符以内" dragonfly="true" onKeyUp="textarealength(this,100)"></textarea>
			<p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
		</div>
	</div>
	
	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
			<input class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" onclick="$('#form-insurance-add').submit()"/>
		</div>
	</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去--> 
<#include "include/_footer.html">
<!--/_footer /作为公共模版分离出去--> 

<!--请在下方写此页面业务相关的脚本--> 
<script type="text/javascript">
function getCarid(){	
		$.ajax({
	            type: 'post', 				 
	            url: '/getCarsByIdcar',
	            data:{'carid':$("#carid").val()},
				success:function(data){ 
	 				if(data.flag == 'true'){
	 					alert("车牌号不存在！！");
	 				}
	           }
		});
	}
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-insurance-add").validate({
		rules:{
			carid:{
				required:true,
				iscarNum:true
			}
		
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			
	   		$.ajax({
	
	            type: 'post', 
				contentType:"application/json", 
	            url: '/addInsurance',
	            data:	JSON.stringify({
		                'carid':$("#carid").val(),
		                'company':$("#company").val(),
		                'companyphone':$("#companyphone").val(),
		                'code':$("#code").val(),
		                'content':$("#content").val(),
		                'money':$("#money").val(),							               
						'contactman':$('#contactman').val() ,
						'contactmobile':$("#contactmobile").val(),
						'remark':$("#remark").val(),
						'validdate':$("#validdate").val(),	
						'invaliddate':$("#invaliddate").val()					 												
						}),	
	            success:function(data){ 
	 				console.log('提交成功！');	 				
	 				var index = parent.layer.getFrameIndex(window.name);
					parent.$("#searchInsurance").click();
					parent.layer.close(index);
	            }
	
	        });

			
		}
	});
});
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>